﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Article.aspx.cs" Inherits="Article" %>
<%@ Register Src="UserControls/Nav.ascx" TagName="Nav" TagPrefix="uc"%>
<%@ Register Src="UserControls/Footer.ascx" TagName="Footer" TagPrefix="uc"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="Generator" content="EditPlus" />
	<meta name="Author" content="FanFu" />
	<meta name="Keywords" content="" />
	<meta name="Description" content="" />

	<title>文章管理</title>
	<link href="css/base.css" rel="stylesheet" type="text/css" />
    <link href="css/custom-theme/jquery-ui-1.8.14.custom.css" rel="stylesheet" type="text/css" />
	<script src="js/jquery-1.6.1.min.js" type="text/javascript"></script>
	<script src="js/effect.js" type="text/javascript"></script>
	<script src="xheditor/xheditor-1.1.10-zh-cn.js" type="text/javascript"></script>
    <script src="js/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
    <script src="js/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#searchStartCreateTime").datepicker({
                maxDate: new Date(9999, 12, 31),
                minDate: new Date(1753, 1, 1),
                autoSize: true,
                changeMonth: true,
                changeYear: true
            });

            $("#searchEndCreateTime").datepicker({
                maxDate: new Date(9999, 12, 31),
                minDate: new Date(1753, 1, 1),
                autoSize: true,
                changeMonth: true,
                changeYear: true
            });
        });

        function ValidatorInput() {
            if ($.trim($("#txtCaption").val()) == "") {
                PopupMsg('error', '文章标题不能为空！');
                $("#txtCaption").focus();
                return false;
            }
            if ($.trim($("#editor").val()) == "") {
                PopupMsg('error', '文章内容不能为空！');
                $("#editor").focus();
                return false;
            }
            return true;
        }

        function ResetInput() {
            $("#txtCaption").val("");
            $("#txtSubCaption").val("");
            $("#txtCreator").val("");
            $("#drpArticleTag option:eq(0)").attr('selected', 'selected');
            $("#drpChannelName option:eq(0)").attr('selected', 'selected');
            $("#drpArticleType option:eq(0)").attr('selected', 'selected');
            $("#chkCanComment")[0].checked = true;
            $("#chkSetTop")[0].checked = false;
            $("#chkFlag")[0].checked = true;
            $("#txtSourceUrl").val("");
            $("#editor").val("");
            $("#fupLogoImg").attr("value","");
            $("#logoimg").attr("src","");
            $("#txtKeywords").val("");
            $("#txtDes").val("");
            $("#txtTitle").val("");
        }

        function AddNew() {
            $("#editState").val("false");
            ResetInput();
        }
    </script>
</head>
<body>
<form id="form1" runat="server">

    <uc:Nav runat="server"/>

    <!-- main_content begin -->
	<div id="main_content" class="clearfix">
		
        <!-- search_box begin -->
        <div class="content_box">
            <div class="box_title">
				<h3 class="subControl">文章搜索</h3>
            </div>
            <div class="box_content">
                <div id="searchBox">
                    <label for="searchCaption">文章标题：</label>
                    <input id="searchCaption" class="textbox" type="text" runat="server"/>
                    <label for="searchStartCreateTime">创建时间：</label>
                    <input style="margin-right:0;" id="searchStartCreateTime" class="textbox" type="text" runat="server"/>
                    <label>至</label>
                    <input id="searchEndCreateTime" class="textbox" type="text" runat="server"/>
                    <label>文章标签：</label>
                    <asp:DropDownList ID="searchArticleTag" class="drplist" runat="server"></asp:DropDownList>
                    <label>所属频道：</label>
                    <asp:DropDownList ID="searchChannel" class="drplist" runat="server"></asp:DropDownList>
                    <label>文章排序：</label>
                    <asp:DropDownList ID="searchOrder" class="drplist" runat="server"></asp:DropDownList>
                    <label>文章类型：</label>
                    <asp:DropDownList ID="searchArticleType" class="drplist" runat="server"></asp:DropDownList>
                    <label>文章状态：</label>
                    <asp:DropDownList ID="searchFlag" class="drplist" runat="server"></asp:DropDownList>
                    <label>允许评论：</label>
                    <asp:DropDownList ID="searchCanComment" class="drplist" runat="server"></asp:DropDownList>
                    <label>是否置顶：</label>
                    <asp:DropDownList ID="searchSetTop" class="drplist" runat="server"></asp:DropDownList>
                    <asp:Button ID="btnSearch" class="button" runat="server" Text="查询" 
                        onclick="btnSearch_Click" />
                </div>
            </div>
        <!-- search_box end -->
        </div>

		<!-- content_box begin -->
		<div class="content_box">
				
			<div class="box_title">
				<h3 class="subControl">文章管理</h3>
				<ul class="box_title_tabs">
					<li class="current">列表</li>
					<li>新建/编辑</li>
				</ul>
			</div>

			<div class="box_content">
					
				<div id="msgPrompt" class="information" style="display:none;">
					<img class="infoclose" alt="关闭" src="images/icons/cross_grey_small.gif" />
					<div>提醒信息！</div>
				</div>

				<div id="dataList" class="box_content_tab">
					<table>
						<thead>
							<tr>
								<th><input id="check_all" type="checkbox" /></th>
								<th>文章标题</th>
								<th>文章标签</th>
								<th>所属频道</th>
								<th>浏览总数</th>
                                <th>评论总数</th>
                                <th>文章类型</th>
                                <th>文章作者</th>
                                <th>创建日期</th>
                                <th>最后修改</th>
                                <th>文章状态</th>
                                <th>用户操作</th>
							</tr>
						</thead>

						<tbody>				
							<asp:Repeater ID="rptDataList" runat="server">
                                <ItemTemplate>
                                    <tr>
								        <td><input value='<%# Eval("ID") %>' type="checkbox" /></td>
								        <td title='<%#Eval("Caption")%>'><%# fanfu.Common.StringPlus.StringDot(Eval("Caption").ToString(),10)%></td>
								        <td><%# new fanfu.Business.ArticleRule().GetArticleTag(Eval("ArticleTag"))%></td>
								        <td><%# Eval("ChannelName")%></td>
                                        <td><%# Eval("BrowserCount")%></td>
                                        <td><%# Eval("CommentCount")%></td>
                                        <td><%# Eval("ArticleType").ToString()=="1"?"原创":"转载"%></td>
                                        <td><%# Eval("Creator")%></td>
                                        <td><%# Eval("CreateTime")%></td>
                                        <td><%# Eval("LastModifyTime")%></td>
                                        <td><%# Eval("Flag").ToString()=="1"?"正常":"删除"%></td>
								        <td>
									        <input title="Edit" class="btnEdit" type="button" onfocus="this.blur()" />
									        <input title="Delete" class="btnDelete" type="button" onfocus="this.blur()" />
								        </td>
							        </tr>
                                </ItemTemplate>
                            </asp:Repeater>
						</tbody>

						<tfoot>
							<tr>
								<td colspan="12">
									<div id="bulk_actions">
                                        <asp:Button ID="btnDelete" class="button" runat="server" Text="批量删除" 
                                            onclick="btnDelete_Click" />
									</div>
									<div id="paging" runat="server"></div>
								</td>
							</tr>
						</tfoot>
					</table>
				</div>
					
				<div id="addEdit" class="box_content_tab" style="display:none;">
					<table>
						<tbody>
							<tr>
								<td width="70"><label for="txtCaption">文章标题：</label></td>
								<td><input id="txtCaption" class="textbox" type="text" runat="server" /></td>
							</tr>
                            <tr>
								<td><label for="txtSubCaption">副标题：</label></td>
								<td><input id="txtSubCaption" class="textbox" type="text" runat="server" /></td>
							</tr>
                            
                            <tr>
								<td><label for="txtCreator">文章作者：</label></td>
								<td><input id="txtCreator" class="textbox" type="text" runat="server" /></td>
							</tr>
                            <tr>
								<td><label>文章标签：</label></td>
								<td><asp:DropDownList ID="drpArticleTag" class="drplist" runat="server"></asp:DropDownList></td>
							</tr>
                            <tr>
								<td><label>所属频道：</label></td>
								<td><asp:DropDownList ID="drpChannelName" class="drplist" runat="server"></asp:DropDownList></td>
							</tr>
                            <tr>
								<td><label>文章类型：</label></td>
                                <td><asp:DropDownList ID="drpArticleType" class="drplist" runat="server"></asp:DropDownList></td>
							</tr>
                            <tr>
								<td><label for="txtSourceUrl">来源Url：</label></td>
								<td><input id="txtSourceUrl" class="textbox" type="text" runat="server" /></td>
							</tr>
							<tr>
								<td><label for="editor">文章内容：</label></td>
								<td>
									<textarea id="editor" class="xheditor {urlType:'root',upLinkUrl:'Upload.aspx',upImgUrl:'Upload.aspx',upFlashUrl:'Upload.aspx',upMediaUrl:'Upload.aspx'}" style="width:100%; height:300px;" runat="server"></textarea>
								</td>
							</tr>
                            <tr>
								<td><label for="chkCanComment">允许评论：</label></td>
								<td><input id="chkCanComment" class="checkbox" type="checkbox" runat="server" />&nbsp;&nbsp;<label class="infotext">(选中允许,未选中不允许)</label></td>
							</tr>
                            <tr>
								<td><label for="chkSetTop">是否置顶：</label></td>
								<td><input id="chkSetTop" class="checkbox" type="checkbox" runat="server" />&nbsp;&nbsp;<label class="infotext">(选中置顶,未选中不置顶)</label></td>
							</tr>
                            <tr>
								<td><label for="chkFlag">是否正常：</label></td>
								<td><input id="chkFlag" class="checkbox" type="checkbox" runat="server" />&nbsp;&nbsp;<label class="infotext">(选中正常,未选中则删除)</label></td>
							</tr>
                            <tr>
								<td><label>Logo上传：</label></td>
								<td><asp:FileUpload class="fileupload" ID="fupLogoImg" runat="server" /></td>
							</tr>
							<tr>
								<td><label>预览Logo：</label></td>
								<td><img id="logoimg" alt="" src="" runat="server" /></td>
							</tr>
                            <tr>
                                <td colspan="2"><label class="infotext">---以下为手动设置SEO内容，如不填写系统会自动设置---</label></td>
                            </tr>
                            <tr>
								<td><label for="txtKeywords">关键字：</label></td>
								<td><input id="txtKeywords" class="textbox" type="text" runat="server" /></td>
							</tr>
                            <tr>
								<td><label for="txtDes">文章描述：</label></td>
								<td><input id="txtDes" class="textbox" type="text" runat="server" /></td>
							</tr>
                            <tr>
								<td><label for="txtTitle">文章Title：</label></td>
								<td><input id="txtTitle" class="textbox" type="text" runat="server" /></td>
							</tr>
						</tbody>
						<tfoot>
							<tr>
								<td>&nbsp;</td>
								<td>
                                    <input class="button" type="button" onclick="AddNew();" value="新建"/>
                                    <input class="button" type="button" onclick="ResetInput();" value="清空" />
                                    <asp:Button class="button" ID="btnSave" runat="server" OnClientClick="return ValidatorInput();" onclick="btnSave_Click" Text="保存" />
								</td>
							</tr>
						</tfoot>
					</table>
				</div> 
			</div>

        <input id="deleteID" type="hidden" runat="server" />
        <input id="editID" type="hidden" runat="server" />
        <input id="editSmallImageSrc" type="hidden" runat="server" />
        <input id="editState" type="hidden" runat="server" />
        <asp:LinkButton ID="lbtnEdit" runat="server" onclick="lbtnEdit_Click"></asp:LinkButton>
		<!-- content_box end -->
		</div>

		<uc:Footer runat="server"/>

	<!-- main_content begin -->
	</div>
</form>
</body>
</html>
